home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '88 / Other stuff / CLIP stuff / CLIP sources / mkmxii.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-04-28  |  3.2 KB  |  84 lines  |  [TEXT/FstE]

  1. /*  Copyright (c)   Mar, 1986   UMMC.  All rights reserved
  2.  
  3. Filename:       mkmxa.c
  4.  
  5. Abstract:       This module contains the code to construct the matrices used to transform between
  6.                 the AP and LAT image coordinate systems.
  7.  
  8. Environment:    UM/CLIP
  9.  
  10. Revision History:
  11.    Rev #       Date    Auth     Reason
  12.    -----    ---------  -----    ----------------------------------
  13.     0.0     18-mar-86   js      original implementation
  14.     0.1     28-apr-86   js      converted to double precision
  15.     
  16. ----------------------------------------------------------------------------------------------------------------------------
  17. NAME:
  18.  
  19.     mkmxii - make coordinate transform matrices (AP/LAT image planes)
  20.  
  21. SYNOPSIS:
  22.  
  23.     ERRCODE mkmxii (p2a, a2p, p2l, l2p, a2l, l2a)
  24.         
  25.         DOUBLE      p2a[9];         array containing 'patient to AP' transform matrix
  26.         DOUBLE      a2p[9];         array containing 'AP to patient' transform matrix
  27.         DOUBLE      p2l[9];         array containing 'patient to LAT' transform matrix
  28.         DOUBLE      l2p[9];         array containing 'LAT to patient' transform matrix
  29.         DOUBLE      a2l[9];         array for return of AP to LAT transform matrix
  30.         DOUBLE      l2a[9];         array for return of LAT to AP transform matrix
  31.  
  32. MODIFIED ARGUMENTS:
  33.  
  34.     a2l and l2a will contain the transform matrices generated from the input matricies
  35.  
  36. FUNCTION:
  37.  
  38.     Matrix methods are used in order to implement transformations between the coordinate
  39.     systems subtended by the AP image plane and the patient.  It is the function of this
  40.     routine to construct the  required matrices based on the angulation of the C-arm as specified
  41.     by the matrices calculated in mkmxa and mkmxl.  The matrices are the result of matrix multiplication
  42.     of the 'stepping stone' matricies as follows:
  43.     
  44.                     [a2l] = [a2p] * [p2l];          [l2a] = [l2p] * [p2a];
  45.                     
  46. PROGRAMMING NOTES:
  47.  
  48.     The elements of the matrices will be stored as sequential rows in the array.
  49.         
  50. EXAMPLES:
  51.  
  52. =========================================================================*/
  53.  
  54. #include    "clipinclude.h"
  55.  
  56.     ERRCODE mkmxii (p2a, a2p, p2l, l2p, a2l, l2a)
  57.  
  58.     DOUBLE      p2a[9];         /* array containing 'patient to AP' transform matrix */
  59.     DOUBLE      a2p[9];         /* array containing 'AP to patient' transform matrix */
  60.     DOUBLE      p2l[9];         /* array containing 'patient to LAT' transform matrix */
  61.     DOUBLE      l2p[9];         /* array containing 'LAT to patient' transform matrix */
  62.     DOUBLE      a2l[9];         /* array for return of AP to LAT transform matrix */
  63.     DOUBLE      l2a[9];         /* array for return of LAT to AP transform matrix */
  64.  
  65.     {
  66.     
  67.     INT         rows = 3;       /* rows in matrices */
  68.     INT         cols = 3;       /* collumns in matrices */
  69.     ERRCODE     erret = OK;     /* error code */
  70.     
  71.     ERRCODE     mxmul ();       /* matrix multiplication routine */
  72.     
  73. /* construct matrices */
  74.  
  75.     erret = mxmul ( a2p, rows, cols, p2l, rows, cols, a2l);
  76.     
  77.     if (erret == OK)
  78.         erret = mxmul ( l2p, rows, cols, p2a, rows, cols, l2a);
  79.     
  80. /* all done */
  81.  
  82.     return (erret);
  83.     
  84.     }